/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "adherent")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Adherent.findAll", query = "SELECT a FROM Adherent a"),
    @NamedQuery(name = "Adherent.findByIdAdherent", query = "SELECT a FROM Adherent a WHERE a.idAdherent = :idAdherent"),
    @NamedQuery(name = "Adherent.findByNom", query = "SELECT a FROM Adherent a WHERE a.nom = :nom"),
    @NamedQuery(name = "Adherent.findByPrenom", query = "SELECT a FROM Adherent a WHERE a.prenom = :prenom"),
    @NamedQuery(name = "Adherent.findByCp", query = "SELECT a FROM Adherent a WHERE a.cp = :cp"),
    @NamedQuery(name = "Adherent.findByVille", query = "SELECT a FROM Adherent a WHERE a.ville = :ville"),
    @NamedQuery(name = "Adherent.findByTelPort", query = "SELECT a FROM Adherent a WHERE a.telPort = :telPort"),
    @NamedQuery(name = "Adherent.findByTelFixe", query = "SELECT a FROM Adherent a WHERE a.telFixe = :telFixe"),
    @NamedQuery(name = "Adherent.findByEmail", query = "SELECT a FROM Adherent a WHERE a.email = :email"),
    @NamedQuery(name = "Adherent.findBySexe", query = "SELECT a FROM Adherent a WHERE a.sexe = :sexe"),
    @NamedQuery(name = "Adherent.findByDateNaissance", query = "SELECT a FROM Adherent a WHERE a.dateNaissance = :dateNaissance"),
    @NamedQuery(name = "Adherent.findByNumLicence", query = "SELECT a FROM Adherent a WHERE a.numLicence = :numLicence")
})
public class Adherent implements Serializable
{
    @Column(name =     "dateNaissance")
    @Temporal(TemporalType.DATE)
    private Date dateNaissance;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idAdherent")
    private Integer idAdherent;
    @Column(name = "nom")
    private String nom;
    @Column(name = "prenom")
    private String prenom;
    @Lob
    @Column(name = "adresse")
    private String adresse;
    @Column(name = "cp")
    private String cp;
    @Column(name = "ville")
    private String ville;
    @Column(name = "telPort")
    private String telPort;
    @Column(name = "telFixe")
    private String telFixe;
    @Column(name = "email")
    private String email;
    @Column(name = "sexe")
    private String sexe;
    @Column(name = "numLicence")
    private String numLicence;
    @JoinTable(name = "inscription", joinColumns =
    {
        @JoinColumn(name = "idAdherent", referencedColumnName = "idAdherent")
    }, inverseJoinColumns =
    {
        @JoinColumn(name = "idSaison", referencedColumnName = "idSaison")
    })
    @ManyToMany
    private List<Saison> saisonList;
    @JoinTable(name = "composition_equipe", joinColumns =
    {
        @JoinColumn(name = "idAdherent", referencedColumnName = "idAdherent")
    }, inverseJoinColumns =
    {
        @JoinColumn(name = "idEquipe", referencedColumnName = "idEquipe")
    })
    @ManyToMany
    private List<Equipe> equipeList;
    @JoinTable(name = "cotise", joinColumns =
    {
        @JoinColumn(name = "idAdherent", referencedColumnName = "idAdherent")
    }, inverseJoinColumns =
    {
        @JoinColumn(name = "idCotisation", referencedColumnName = "idCotisation")
    })
    @ManyToMany
    private List<Cotisation> cotisationList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "adherent")
    private List<Transporteur> transporteurList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "adherent")
    private List<Disponibilite> disponibiliteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCapitaine")
    private List<Equipe> equipeList1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idResponsable")
    private List<Deplacement> deplacementList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "adherentidAdherent")
    private Utilisateur utilisateur;

    public Adherent()
    {
    }

    public Adherent(Integer idAdherent)
    {
        this.idAdherent = idAdherent;
    }

    public Integer getIdAdherent()
    {
        return idAdherent;
    }

    public void setIdAdherent(Integer idAdherent)
    {
        this.idAdherent = idAdherent;
    }

    public String getNom()
    {
        return nom;
    }

    public void setNom(String nom)
    {
        this.nom = nom;
    }

    public String getPrenom()
    {
        return prenom;
    }

    public void setPrenom(String prenom)
    {
        this.prenom = prenom;
    }

    public String getAdresse()
    {
        return adresse;
    }

    public void setAdresse(String adresse)
    {
        this.adresse = adresse;
    }

    public String getCp()
    {
        return cp;
    }

    public void setCp(String cp)
    {
        this.cp = cp;
    }

    public String getVille()
    {
        return ville;
    }

    public void setVille(String ville)
    {
        this.ville = ville;
    }

    public String getTelPort()
    {
        return telPort;
    }

    public void setTelPort(String telPort)
    {
        this.telPort = telPort;
    }

    public String getTelFixe()
    {
        return telFixe;
    }

    public void setTelFixe(String telFixe)
    {
        this.telFixe = telFixe;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getSexe()
    {
        return sexe;
    }

    public void setSexe(String sexe)
    {
        this.sexe = sexe;
    }

    public String getNumLicence()
    {
        return numLicence;
    }

    public void setNumLicence(String numLicence)
    {
        this.numLicence = numLicence;
    }

    @XmlTransient
    public List<Saison> getSaisonList()
    {
        return saisonList;
    }

    public void setSaisonList(List<Saison> saisonList)
    {
        this.saisonList = saisonList;
    }

    @XmlTransient
    public List<Equipe> getEquipeList()
    {
        return equipeList;
    }

    public void setEquipeList(List<Equipe> equipeList)
    {
        this.equipeList = equipeList;
    }

    @XmlTransient
    public List<Cotisation> getCotisationList()
    {
        return cotisationList;
    }

    public void setCotisationList(List<Cotisation> cotisationList)
    {
        this.cotisationList = cotisationList;
    }

    @XmlTransient
    public List<Transporteur> getTransporteurList()
    {
        return transporteurList;
    }

    public void setTransporteurList(List<Transporteur> transporteurList)
    {
        this.transporteurList = transporteurList;
    }

    @XmlTransient
    public List<Disponibilite> getDisponibiliteList()
    {
        return disponibiliteList;
    }

    public void setDisponibiliteList(List<Disponibilite> disponibiliteList)
    {
        this.disponibiliteList = disponibiliteList;
    }

    @XmlTransient
    public List<Equipe> getEquipeList1()
    {
        return equipeList1;
    }

    public void setEquipeList1(List<Equipe> equipeList1)
    {
        this.equipeList1 = equipeList1;
    }

    @XmlTransient
    public List<Deplacement> getDeplacementList()
    {
        return deplacementList;
    }

    public void setDeplacementList(List<Deplacement> deplacementList)
    {
        this.deplacementList = deplacementList;
    }

    public Utilisateur getUtilisateur()
    {
        return utilisateur;
    }

    public void setUtilisateur(Utilisateur utilisateur)
    {
        this.utilisateur = utilisateur;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idAdherent != null ? idAdherent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Adherent))
        {
            return false;
        }
        Adherent other = (Adherent) object;
        if ((this.idAdherent == null && other.idAdherent != null) || (this.idAdherent != null && !this.idAdherent.equals(other.idAdherent)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Adherent[ idAdherent=" + idAdherent + " ]";
    }

    public Date getDateNaissance()
    {
        return dateNaissance;
    }

    public void setDateNaissance(Date dateNaissance)
    {
        this.dateNaissance = dateNaissance;
    }
    
}
